/**
 * Author: Dmitry Ustimov
 * Date: 5/15/13
 * Time: 10:15 AM
 */

package com.gmail.dmitryustimov.ms.java7.mediator.mod.example;

import java.util.ArrayList;
import java.util.List;

public class Mediator<T extends Colleague> {

    List<T> colleagues = new ArrayList<>();

    void addColleague(T colleague) {
        for (T oldColleague: colleagues) {
            oldColleague.eventPublisher.subscribe(colleague.action);
            colleague.eventPublisher.subscribe(oldColleague.action);
        }
        colleagues.add(colleague);
    }

}
